package com.kt.demo.service;

import com.kt.demo.dao.DevUserMapper;
import com.kt.demo.pojo.DevUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DevService implements DevUserMapper {
    @Autowired
    private DevUserMapper devUserMapper;
    @Override
    public int deleteByPrimaryKey(Long id) {
        return 0;
    }

    @Override
    public int insert(DevUser record) {
        return 0;
    }

    @Override
    public int insertSelective(DevUser record) {
        return 0;
    }

    @Override
    public DevUser selectByPrimaryKey(Long id) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(DevUser record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(DevUser record) {
        return 0;
    }

    @Override
    public DevUser doLogin(String devCode, String devPassword) throws Exception {
        DevUser devUser = devUserMapper.doLogin(devCode, devPassword);
        try {
            if(devUser==null){
                return null;
            }
            if(null!=devUser){
                if(devUser.getDevPassword().equals(devPassword)&&devUser.getDevCode().equals(devCode)){
                    devUser=devUser;
                }else {
                    devCode=null;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return devUser;
    }
}
